<?php

namespace Module\Department\Core;

use Illuminate\Events\Dispatcher;
use Illuminate\Support\ServiceProvider;
use ModStart\Admin\Config\AdminMenu;
use Module\Vendor\Admin\Widget\AdminWidgetLink;

class ModuleServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot(Dispatcher $events)
    {
        // 注册管理菜单
        AdminMenu::register(function(){
            return [
                [
                    'title' => '内容管理',
                    'icon' => 'file',
                    'sort' => 150,
                    'children' => [
                        [
                             'title' => '部门管理',
                             'children' => [

                                 [
                                     'title' => '部门管理列表',
                                     'url' => '\Module\Department\Admin\Controller\DepartmentController@index',
                                 ],
                                 [
                                      'title' => '部门管理设置',
                                      'url' => '\Module\Department\Admin\Controller\ConfigController@index',
                                  ],
                             ]
                        ],
                    ]

                 ],
                 /*
                 [
                     'title' => '功能设置',
                     'icon' => 'tools',
                     'sort' => 300,
                     'children' => [ ]
                 ],
                 [
                    'title' => L('Site Manage'),
                    'icon' => 'cog',
                    'sort' => 400,
                    'children' => [ ]
                 ]
                */
            ];
        });
        AdminWidgetLink::register(function () {
            $menu = [];
            $menu[] = ['部门管理', modstart_web_url('department')];
            return AdminWidgetLink::build('内容', $menu);
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

    }
}
